package com.vilen.learn.java7;

import java.io.File;
import java.io.FilePermission;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.attribute.FileAttribute;
import java.nio.file.attribute.PosixFilePermission;
import java.nio.file.attribute.PosixFilePermissions;
import java.util.Set;

/**
 * Created by vilen on 2017/9/21.
 */
public class L_2_4 {
    public static void main(String[] args) throws IOException {
        /**
         * 创建和删除文件
         */
//        Path target = Paths.get("E:\\my_data\\IdeaProject\\test\\Java7\\src\\main\\resources\\newfile.txt");
//        Path file = Files.createFile(target);


        /**
         *
         */
        try{
            Path txt = Paths.get("E:\\my_data\\IdeaProject\\test\\Java7\\src\\main\\resources\\newfile.txt");

            System.out.println(Files.getLastModifiedTime(txt));
            System.out.println(Files.size(txt));
            System.out.println(Files.isSymbolicLink(txt));
            System.out.println(Files.isDirectory(txt));
            System.out.println(Files.readAttributes(txt,"*")); // 批量读取
        }catch (IOException e){
            System.out.println(e.getMessage());
        }
    }
}